﻿@page "{categoryId&page=1}"
@inject ArticleService articleService
@inject CategoryService categoryService

@functions{

    PagedCollection<Article> Articles { get; set; }

    Category Category { get; set; }

    public async Task OnGetAsync(int categoryId, int page = 1)
    {
        this.Articles = await articleService.GetArticlesAsync(new ArticleService.Query { Page = page, CategoryId = categoryId });

        this.Category = await categoryService.GetCategoryAsync(categoryId);
        ViewBag.Title = this.Category.Name;
    }
}
<div class="row">
    <div class="col-8">
        <h4>@this.Category.Name</h4>
        <hr />
        @Html.Partial_ArticleList(Articles.Items)
        <div class="mt-3">
            @Html.Pagination(Articles)
        </div>
    </div>
    <div class="col-4">
        @Html.Partial_CategoryList()
        @Html.Partial_ArticleRecommandList(new RecommandArticleViewModel(this.Category.Id) )
    </div>
</div>
